package main

import (
	"gin/cdai"
	"gin/database"
	"gin/queue"
	"gin/router"
	"github.com/spf13/viper"
	"os"
)

func main() {
	InitConfig()
	Mysql.InitDB()
	queue.Init()
	cdai.Init()
	router.InitRouter()
}

func InitConfig() {
	workDir, _ := os.Getwd()
	viper.SetConfigName("application")
	viper.SetConfigType("yml")
	viper.AddConfigPath(workDir + "/config")
	err := viper.ReadInConfig()
	if err != nil {
		panic(err)
	}
}
